﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;


namespace tjb.Utility.Gather
{
    /// <summary>
    /// 内容过滤接口
    /// </summary>
    /// <typeparam name="T">返回值类型</typeparam>
    public interface IContentRule<T>
    {
        /// <summary>
        /// 
        /// </summary>
        string FieldName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        string FriendlyName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        List<Rule> Rules
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        T GetValue();
    }
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="T">返回值类型</typeparam>
    public abstract class RuleBase<T>
    {
        /// <summary>
        /// 存储的字段名称
        /// </summary>
        [XmlAttribute("FieldName")]
        public string FieldName
        {
            get;
            set;
        }
        /// <summary>
        /// 显示的友好名称
        /// </summary>
        [XmlAttribute("FriendlyName")]
        public string FriendlyName
        {
            get;
            set;
        }

    }
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class RuleGroup : IContentRule<int>
    {
        #region IContentRule<string> 成员
        /// <summary>
        /// 
        /// </summary>
        public string FieldName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public string FriendlyName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public List<Rule> Rules
        {
            get;
            set;
        }


        #endregion



        #region IContentRule<int> 成员

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public int GetValue()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
